package com.xizi.lotterySystem.service.enumerate;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
public enum UserIdentityEnum {
    admin("管理员"),
    NORMAL("普通用户");
    private String value;

    public static UserIdentityEnum getByValue(String value) {
        for (UserIdentityEnum e : UserIdentityEnum.values()) {
            System.out.println(e.name());
            if (e.name().equalsIgnoreCase(value)) {
                return e;
            }
        }
        throw new IllegalArgumentException("无效的 value = " + value);
    }

    public String getValue() {
        return value;
    }
}
